const state = {
  userInfo:{
    name:'jack',
    age:23
  }
}

const mutations = {
  setUser (state, newUserInfo) {
    state.userInfo = newUserInfo
  }
}

const getters = {}

const actions = {
  setUserSecond (context, newUserInfo) {
    // 将异步在action中进行封装
    setTimeout(() => {
      // 调用mutation   context上下文，默认提交的就是自己模块的action和mutation
      context.commit('setUser', newUserInfo)
    }, 1000)
  }
}


export default {
  namespaced: true,
  state,
  mutations,
  getters,
  actions
}